<template>
  <div class="NavBar">
    <ul>
      <li :class="{active: $route.path != '/' + item.path}" v-for="item in list" :key="item.path" @click="toPage(item.path)">
        <img
          :src="
            $route.path == '/' + item.path ? item.meta.icon : item.meta.iconsel
          "
          alt=""
        />
        <p>{{ item.meta.title }}</p>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  computed: {
    list() {
      let routes = this.$router.options.routes[1].children;
    //   console.log(routes);
      return routes;
    },
  },
  methods: {
    toPage(path) {
        if(this.$route.path=='/'+path){
            return;
        }
      this.$router.push(path);
    },
  },
};
</script>

<style lang="scss" scoped>
.NavBar {
  width: 100vw;
  height: 120px;
  background-color: bisque;
  position: fixed;
  bottom: 0;
  > ul {
    list-style: none;
    display: flex;
    > li {
      cursor: pointer;
      flex: 1;
      >img{
          width: 40px;
          height: 40px;
          margin-top: 15px;
      }
    }
  }
  .active{
      color: #E1BC8C;
  }
}
</style>